<?php
/* @var $this NdkHealthController */
/* @var $model NdkHealth */
/* @var $form TbActiveForm */
?>

<div class="form">

    <?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'ndk-health-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>
		<div class="row">
		<div class="col-md-4">
			<div class="widget box">
				<div class="widget-header">
					<h4><i class="icon-reorder"></i> Form Non Premi </h4>
				</div>
				<div class="widget-content">

            <?php echo $form->hiddenField($model,'no_invoice',array('span'=>5,'maxlength'=>50)); ?>

            
			
			<div class="control-group">
				<label class="control-label">
				Nama Client
				<span class="required">*</span>
				</label>
				<div class="controls">
					<div class="input-group">
						<?php echo $form->textField($model,'nama_client',array('span'=>5,'maxlength'=>50,'class'=>'form-control input-width-large')); ?>
						<a class="btn btn-default btn-warning" href="#myModal" data-toggle="modal" style="float:right">FIND</a>
					</div>
				</div>
			</div>
			
            <?php echo $form->hiddenField($model,'mst_client_id',array('span'=>5)); ?>
			
			<div class="control-group">
				<label class="control-label">
				COA Debet
				<span class="required">*</span>
				</label>
				<div class="controls">
					<div class="input-group">
						<input type="text" name="txt_coa_debet" id="txt_coa_debet" class="form-control  input-width-large span5" />
						<a class="btn btn-default btn-warning" href="#myModal2" data-toggle="modal" style="float:right">FIND</a>
					</div>
				</div>
			</div>
			<?php echo $form->hiddenField($model,'mst_coa_id_debet',array('span'=>5,'class'=>'form-control')); ?>
			
			<div class="control-group">
				<label class="control-label">
				COA Kredit
				<span class="required">*</span>
				</label>
				<div class="controls">
					<div class="input-group">
						<input type="text" name="txt_coa_kredit" id="txt_coa_kredit" class="form-control  input-width-large span5" />
						<a class="btn btn-default btn-warning" href="#myModal3" data-toggle="modal" style="float:right">FIND</a>
					</div>
				</div>
			</div>
            <?php echo $form->hiddenField($model,'mst_coa_id_kredit',array('span'=>5,'class'=>'form-control')); ?>

            <?php echo $form->textFieldControlGroup($model,'due_date',array('span'=>5,'data-mask'=>'99-99-9999','class'=>'form-control')); ?>

            <?php echo $form->textFieldControlGroup($model,'nominal',array('span'=>5,'class'=>'form-control')); ?>

            <?php echo $form->textAreaControlGroup($model,'keterangan',array('span'=>5,'maxlength'=>100,'class'=>'form-control')); ?>


				</div>
			</div>
		</div>
</div>		
        <div class="form-actions">
        <?php echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array(
		    'color'=>TbHtml::BUTTON_COLOR_PRIMARY,
		    'size'=>TbHtml::BUTTON_SIZE_LARGE,
		)); ?>
    </div>

    <?php $this->endWidget(); ?>

</div><!-- form -->


<div id="myModal" class="modal fade in" style="display: none;" aria-hidden="false">
												<div class="modal-dialog" style="width:700px;">
													<div class="modal-content">
														<div class="modal-header">
															<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
															<h4 class="modal-title">Pilih Client</h4>
														</div>
														<div class="modal-body">
															
															<?php echo $this->renderPartial('//ndkHealth/_viewClient', array('model'=>$model2));  // I need $productId to by dynamic related to link 
                ?> 
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
															<button id="btnTest" data-dismiss="modal" class="btn btn-primary" type="button">Pilih</button>
														</div>
													</div><!-- /.modal-content -->
												</div><!-- /.modal-dialog -->
	</div>
	
<div id="myModal2" class="modal fade in" style="display: none;" aria-hidden="false">
												<div class="modal-dialog" style="width:700px;">
													<div class="modal-content">
														<div class="modal-header">
															<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
															<h4 class="modal-title">Pilih COA</h4>
														</div>
														<div class="modal-body">
															
				<?php echo $this->renderPartial('_viewcoadebet', array('model'=>$model3));  // I need $productId to by dynamic related to link 
                ?> 
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
															<button id="btnTest2" data-dismiss="modal" class="btn btn-primary" type="button">Pilih</button>
														</div>
													</div><!-- /.modal-content -->
												</div><!-- /.modal-dialog -->
	</div>
	
<div id="myModal3" class="modal fade in" style="display: none;" aria-hidden="false">
												<div class="modal-dialog" style="width:700px;">
													<div class="modal-content">
														<div class="modal-header">
															<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
															<h4 class="modal-title">Pilih COA</h4>
														</div>
														<div class="modal-body">
															
															<?php echo $this->renderPartial('_viewcoakredit', array('model'=>$model4));  // I need $productId to by dynamic related to link 
                ?> 
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
															<button id="btnTest3" data-dismiss="modal" class="btn btn-primary" type="button">Pilih</button>
														</div>
													</div><!-- /.modal-content -->
												</div><!-- /.modal-dialog -->
	</div>
	
	
	<script type="text/javascript">
	$("#btnTest").click(function()
{
   $("#NdkPremiNon_nama_client").val($('input:radio[name=user]:checked').attr('nama_client'));
   $("#NdkPremiNon_mst_client_id").val($('input:radio[name=user]:checked').attr('id_number'));
}); 

	$("#btnTest2").click(function()
{
   $("#txt_coa_debet").val($('input:radio[name=user]:checked').val());
   $("#NdkPremiNon_mst_coa_id_debet").val($('input:radio[name=user]:checked').attr('id_number'));
}); 

	$("#btnTest3").click(function()
{
   $("#txt_coa_kredit").val($('input:radio[name=user]:checked').val());
   $("#NdkPremiNon_mst_coa_id_kredit").val($('input:radio[name=user]:checked').attr('id_number'));
}); 
	</script>